//
//  HDJiHuoTableViewCell.swift
//  Wmsmobile
//
//  Created by wangshuning on 16/9/27.
//  Copyright © 2016年 www.hd123.com. All rights reserved.
//

import UIKit

class HDJiHuoTableViewCell: HDFounctionBaseCell, UITextFieldDelegate {
    
    var dict:[String : String]?{
        didSet{
            label1.text = dict!["left"]
            label1.textColor = UIColor.hexStringToUIColor("#666666")
            label1.font = UIFont.systemFont(ofSize: self.getFont())
            label2.text = dict!["middle"]
            label2.textColor = UIColor.hexStringToUIColor("#666666")
            label2.font = UIFont.systemFont(ofSize: self.getFont())
            label3.text = dict!["right"]
            label3.delegate = self
            label3.textColor = UIColor.hexStringToUIColor("#666666")
            label3.font = UIFont.systemFont(ofSize: self.getFont())
        }
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.contentView.addSubview(label1)
        self.contentView.addSubview(label2)
        self.contentView.addSubview(label3)
        
        label1.snp.makeConstraints { (make) in
            make.left.equalTo(self.contentView).offset(18)
            make.centerY.equalTo(self.contentView)
//            make.width.equalTo(80)
        }
        label2.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.contentView)
            make.centerX.equalTo(self.contentView)
        }
        label3.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.contentView)
            make.trailing.equalTo(self.contentView).offset(-28)
//            make.width.equalTo(80)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    required init() {
        fatalError("init() has not been implemented")
    }
    
    
    lazy  var label1:UILabel = {
        let label = UILabel()
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    lazy  var label2:UILabel = {
        let label = UILabel()
//        label.placeholder = "请输入"
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    lazy  var label3:UITextField = {
        let label = UITextField()
        label.placeholder = "请输入"
        label.textAlignment = .right
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    
    //MARK: - textFieldDelegate
    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
        label3.text = textField.text
        print("label3.text=\(label3.text)")
        return true
    }
    
}
